package com.gaohui.nestedrecyclerview.java.viewholder;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.gaohui.nestedrecyclerview.R;
import com.gaohui.nestedrecyclerview.java.adapter.MultiTypeAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : xfhy
 * Create time : 2021/3/8 9:27
 * Description :
 */
public class HorizontalRvViewHolder extends RecyclerView.ViewHolder {
    public RecyclerView mRv;

    public HorizontalRvViewHolder(@NonNull View itemView) {
        super(itemView);
        mRv = itemView.findViewById(R.id.rv_horizontal);
    }

    public void bindData() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mRv.getContext(), LinearLayoutManager.HORIZONTAL, false);
        mRv.setLayoutManager(linearLayoutManager);
        MultiTypeAdapter multiTypeAdapter = new MultiTypeAdapter(getTestData());
        mRv.setAdapter(multiTypeAdapter);
    }

    private ArrayList<Object> getTestData() {
        ArrayList<Object> data = new ArrayList<>();
        for (int i = 0; i < 100; i++) {
            data.add(i+"");
        }
        return data;
    }

}

